.TH std::valarray::resize 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::valarray::resize \- std::valarray::resize

.SH Synopsis
   void resize( std::size_t count, T value = T() );

   Resizes the valarray to contain count elements and assigns value to each element.

   This functions invalidates all pointers and references to elements in the array.

.SH Parameters

   count - new size of the container
   value - the value to initialize the new elements with

.SH Return value

   \fI(none)\fP

.SH Example


// Run this code

 #include <iostream>
 #include <valarray>

 int main()
 {
     std::valarray<int> v{1, 2, 3};
     v.resize(10);
     for (int n : v)
         std::cout << n << ' ';
     std::cout << '\\n';
 }

.SH Output:

 0 0 0 0 0 0 0 0 0 0

.SH See also

   size returns the size of valarray
        \fI(public member function)\fP
